package com.aop.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Order(2)
@Aspect
@Component
public class AllAspect {

    @Pointcut("execution(* com.aop.controller.AopController.hello(..))")
    public void helloWorld() {
    }

    @Pointcut("@annotation(com.validate.annotation.MyValidate)")
    public void annotation() {
    }

    @Before("annotation() || helloWorld()")
    public void beforeMethod(JoinPoint joinPoint) {
        System.out.println("^^^^^^^^all aspect.");
    }

}
